﻿@using Fyp.Models;
@using Fyp.Controllers;
@{
    Layout = "~/Shared/_layoutPage.cshtml";
    var PageTitle = "Assign Task";

    List<SelectListItem> items = new List<SelectListItem>();
    items.Add(new SelectListItem
    {
        Text = "Select Group Id",
        Value = "0",
        Selected = true
    });
    for (int j = 0; j < global.glst.Count(); j++)
    {
        items.Add(new SelectListItem
        {
            Text = global.glst[j].GId.ToString(),
            Value = global.glst[j].GId.ToString(),
        });
    }
    string s = "c";
    int i = 1;
}
@section title
{
    @PageTitle;
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="~/Styles/template.css" media="screen">
<script src="/Scripts/jquery-1.8.2.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui.js" type="text/javascript"></script>
<link href="../../Styles/jquery.ambiance.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery.ambiance.js" type="text/javascript"></script>
<style type="text/css">
#AssignTaskMainDiv 
{
    margin-left:5px;
    height:auto;
    width:950px;
    background-color:azure;
    margin-bottom:-18px;
}
#AssignTaskMainDiv #AssignTaskDiv #GroupForm #DropDownList1
{
    margin-left:-656px;
    margin-top:30px;
}
#AssignTaskMainDiv #AssignTaskDiv #StudentsForm 
{
    margin-left:65px;
    height:auto;
    width:884px;
}
#AssignTaskMainDiv #AssignTaskDiv #AssignTaskTable
{ margin-left:47px;
  margin-top:12px;
}  
#AssignTaskMainDiv #AssignTaskDiv #AssignTaskTable td
{
  width:142px;
  height:80px;
}
#AssignTaskMainDiv #AssignTaskDiv #AssignTaskTable td textarea
{
  width:300px;
  height:117px;
}
#AssignTaskMainDiv #AssignTaskDiv input[name="button"]
{ 
  margin-top:-2px;
  margin-left:45px;
}
#AssignTaskMainDiv #AssignTaskDiv #AssignStudentsTaskTable 
{
    width:810px;
    text-align:center;
    margin-left:50px;
}
td 
{
border:1px solid green; 
padding:2px;    
}
th 
{
    background-color:green;
    color:white;
    padding:2px;
    border:1px solid green; 
}
</style>
<script>
    $(document).ready(function () {
    $("#DropDownList1").change(function () {
          $("#DropDownList1 option:selected").text();
    });
    $('#checkall').change(function ()
    {
       var checkboxes = $(this).closest('form').find(':checkbox');
       if ($("input#checkall").is(':checked')) {
           checkboxes.attr('checked', 'checked');
       }
       else {
           checkboxes.removeAttr('checked');
       }
    });
    $("#assignedcancelbtn").click(function () {
        $.ambiance({
            message: "Cancel Submission!",
            type: "error",
            fade: false
        });
    })
    });
</script>
</head>
<body>
<div id="AssignTaskMainDiv">
<br/><strong>
            <div id="content"  style="margin-left: 98px;margin-bottom: -1px;">
                 <h2 style="text-align: center;">Submit daily task</h2>
             </div>
    </strong> 
<div id="AssignTaskDiv">
<br/>
@using (Html.BeginForm("ShowStudents", "SubmitDailyTask", FormMethod.Post, new { @id = "GroupForm" }))
{
<br/><br/><br/>
@Html.DropDownList("DropDownList1", items)    
<input type="Submit" value="ShowStudents" name="button" class="buttonSave" />  
}
@using (Html.BeginForm("Assign", "SubmitDailyTask", FormMethod.Post, new { enctype = "multipart/form-data", @id = "StudentsForm" }))
{
<br />    
<div id="grid"> 
</div> 
<table id="AssignStudentsTaskTable" border="1">
       <thead>
       <tr>
          <th><input type="checkbox" id="checkall" name="all"/>Check</th>
          <th>Select Students To Assign Task</th>
       <tr>
       <th>Assign</th>
       <th>Name</th>
       <th>Student ID</th>
       <th>Degree</th>
       <th>Email</th>
       </tr>
       </thead>
       <tbody id="ttbody">
        @foreach (var stu in global.lst)
        {
            string v = @s + i;
           <tr>
               <td><input type="checkbox" id="@v" name="@v"/></td>
               <td><label>@stu.Std_Name</label></td>
               <td><label>@stu.Std_RegId</label></td>
               <td><label>@stu.Degree</label></td>
               <td><label>@stu.Std_Email</label></td>
            </tr>
            i++;
        }
       </tbody>
 </table>
@*<h1>@ViewBag.Message</h1>
<h1>@ViewBag.tick</h1>  
<h1>@ViewBag.cross</h1>  
<h1>@ViewBag.tickm</h1>  
<h1>@ViewBag.crossm</h1>  
*@
<table id="AssignTaskTable">
<tbody>
<tr><td><label>Task Description</label></td>
<td><textarea rows="0" cols="15" name="tdescription"></textarea></td>
</tr>
<tr>
<td><label id="b1">Attach Task</label></td>
<td><input type="file" name="upload"/></td>
</tr>
</tbody>
</table>
<input type="Submit" value="Assign" name="button" class="buttonSave"/>
<input type="button" value="Cancel" class ="buttonCancel" id="assignedcancelbtn"/>
}
</div>
</div>
</body>
</html>
